@layout("/common/_container.html"){
<style>
    ul{padding: 0;}
    .nav-tabs > li{ flex: 1; }
    .nav-tabs > li > a{  border:1px solid #cccccc;  color: #666666;  text-align: center; }
    .nav-tabs > li.active > a,
    .nav-tabs > li.active > a:hover,
    .nav-tabs > li.active > a:focus {  border:1px solid #30add2;  color: #30add2;  }

    .ulBox>li{ line-height: 35px;}
    .ulBox>li>span:first-of-type{display: inline-block;width: 25%;text-align: right;border-right: 1px solid #cccccc;padding-right: 25px;}
    .ulBox>li>span:last-of-type{padding-left: 25px;}
    .inpStyle{ width: 38% ; height: 32px; border-radius: 5px; border: 1px solid #A9A9A9;padding-left: 15px;}
    .ulStyle>li{ margin-bottom: 20px; }
    .ulStyle>li>span{text-align: right ; color: #666666;}

    .btnBox>button{ background: white; border: 1px solid #cccccc;width: 90px; }

    .ibox-content{ padding: 0 20px;}

    #dropdownMenu1,#dropdownMenu2{ margin: 0;  background: white; color: #666666;}
    #accordion>h3{margin-top: 10px;background: #fff5e4}
    #accordion>h3:hover,#accordion>h3:focus{background: #e8fdff}

    .accordions{border: 1px solid #cccccc;border-radius: 3px;margin-top: 10px;overflow: hidden}
    .accordions>p{ border-bottom: 1px solid #cccccc;background: #fff5e4;line-height:30px;text-indent: 1em}
    .accordions .ule span:first-of-type{display: inline-block;width: 19%;border-right: 1px solid #cccccc;padding-left: 20px;}
    .accordions .ule span:last-of-type{padding-left: 20px;}
    .ule>li{line-height: 30px;}

</style>
<div class="ibox float-e-margins">
    <div class="ibox-content clearfix">
        <div style="display: none">
            <input type="hidden" id="id" value="${consultantInfo.id}">
            <input type="hidden" id="doctorVisitId" value="${doctorRevisitInfo.id}">
            <input type="hidden" id="reservationsId" value="${consultantInfo.reservationsId}">
        </div>
        <div class="row" id="doctorLookedInfoForm">
            <div>
                <div class="col-sm-6" style="border-right: 1px solid #cccccc;">
                    <div class="row">
                        <div class="col-sm-12" style="border-bottom: 1px solid #cccccc;padding: 20px 0;">
                            <ul class="ulBox">
                                <li><span>患者姓名</span><span>${consultantInfo.customerName}</span></li>
                                <li><span>病历号</span><span>${consultantInfo.medicalRecordNumber}</span></li>
                                <li><span>初诊日期</span><span>${consultantInfo.firstVisitDate}</span></li>
                                <li><span>患者来源</span><span>${consultantInfo.oneChannel}</span></li>
                                <li><span>电话号码</span><span>${consultantInfo.customerPhone}</span></li>
                            </ul>
                        </div>
                    </div>
                    <div class="row" style="margin-top: 30px;">
                        <ul class="ulStyle clearfix">
                            <li class="col-sm-12">
                                <span class="col-sm-4">随访时间：</span>
                                <input id="revisitTime" readonly="readonly" class="inpStyle col-sm-8" value="${doctorRevisitInfo.revisitTime}" type="text" onclick="laydate({istiem:true,format:'YYYY-MM-DD'})">
                            </li>
                            <li class="col-sm-12">
                                <span class="col-sm-4">随访医生：</span>
                                <select id="doctor"  class="inpStyle col-sm-8" name="doctor"></select>
                            </li>
                            <li class="col-sm-12">
                                <span class="col-sm-4">创建人：</span>
                                <input id="createName" disabled="disabled" class="inpStyle col-sm-8" name="" value="${createName}"></input>
                            </li>
                            <li class="col-sm-12" style="line-height: 40px;">
                                <span class="col-sm-4">内容模板：</span>
                                <div class="btn-group">
                                    <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                        内容模板<span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" aria-labelledby="dropdownMenu2" style="left: 0;">
                                        <li id="currency"><a href="javascript:;">通用随访模板</a></li>
                                        <li id="scaling"><a href="javascript:;">洁牙</a></li>
                                        <li id="threeFollow"><a href="javascript:;">三个月随访</a></li>
                                        <li id="yearFollow"><a href="javascript:;">一年后随访</a></li>
                                    </ul>
                                </div>
                            </li>
                            <li class="col-sm-12">
                                <span class="col-sm-4">随访内容：</span>
                                <textarea id="remarks" class="col-sm-8" name="remarks" style="height: 100px;width: 60%">${doctorRevisitInfo.remarks}</textarea>
                            </li>
                            <li class="col-sm-12" style="line-height: 40px;">
                                <span class="col-sm-4">结果模板：</span>
                                <div class="btn-group">
                                    <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                        结果模板<span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" aria-labelledby="dropdownMenu1" style="left: 0;">
                                        <li><a href="javascript:;" id="followResults">洁牙正常</a></li>
                                    </ul>
                                </div>
                            </li>
                            <li class="col-sm-12">
                                <span class="col-sm-4">随访结果：</span>
                                <textarea id="revisitContent" class="col-sm-8" name="revisitContent" style="height: 100px;width: 60%">${doctorRevisitInfo.revisitContent}</textarea>
                            </li>
                            <li class="col-sm-12">
                                <div class="col-sm-4"></div>
                                <div class="col-sm-8" style="padding: 0;">
                                    <div class="btnBox">
                                        <button class="btn" type="button" id="submit">保存</button>
                                        <button class="btn" type="button" onclick="cancel()">取消</button>
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>

                <div class="col-sm-6">
                    <div style="margin-top: 30px">
                        <div class="nav_table" id="consultantInfoForm">
                            <ul class="nav nav-tabs" role="tablist" style="display: flex">
                                <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">就诊记录</a></li>
                                <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">随访记录</a></li>
                            </ul>
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active" id="home">
                                    <div id="accordion">

                                        @for(item in DoctorDiagnosisInfoList){
                                        <h3 class="clearfix"><span>时间：${item.diagnoseTime}</span><span style="float: right;width: 140px;">医生：${item.doctor}</span></h3>
                                        <div class="accordion">
                                            <ul class="ule">
                                                <li><span style="display: inline-block;width: 170px;">医助：</span><span>咨询师：${item.fieldTc}</span></li>
                                                <li><span>预约：</span><span>${item.payServiceName}</span></li>
                                                <li><span>备注：</span><span>${item.remarks}</span></li>
                                            </ul>
                                            <div style="border-top: 1px solid #cccccc;padding-top: 5px;">
                                                <ul class="ule">
                                                    <li style="display: flex"><span style="flex: 1;">诊断：</span><span style="flex: 6;">${item.diagnose}</span></li>
                                                    <li style="display: flex"><span style="flex: 1;">处置：</span><span style="flex: 6;">${item.dispose}</span></li>
                                                    <li style="display: flex"><span style="flex: 1;">医嘱：</span><span style="flex: 6;">${item.doctorAdvice}</span></li>
                                                </ul>
                                            </div>
                                        </div>
                                        @}
                                    </div>
                                </div>

                                <div role="tabpanel" class="tab-pane" id="profile">
                                    <div id="accordions">
                                        @for(item in doctorRevisitInfoList){
                                        <div class="accordions">
                                            <p><span>${item.revisitTime}&nbsp;</span>
                                                @if(item.revisitStatus == 1){
                                                <span>状态：待计划</span>
                                                @}
                                                @if(item.revisitStatus == 2){
                                                <span>状态：随访完成</span>
                                                @}
                                            </p>
                                            <ul class="ule">
                                                <li><span>诊所</span><span></span></li>
                                                <li><span>医生</span><span>${item.doctor}</span></li>
                                                <li><span>创建人</span><span>${item.doctor}</span></li>
                                            </ul>
                                            <div style="border-top: 1px solid #cccccc;padding-top: 5px;">
                                                <ul class="ule">
                                                    <li><span style="border: none">内容</span><span>${item.remarks}</span></li>
                                                    <li><span style="border: none">结果</span><span>${item.revisitContent}</span></li>
                                                </ul>
                                            </div>
                                        </div>
                                        @}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<link rel="stylesheet" href="${ctxPath}/static/css/jqui/jquery-ui.min.css">
<script src="${ctxPath}/static/js/jquery-ui.min.js"></script>
<script src="${ctxPath}/static/modular/doctorLooked/doctorLooked_info.js"></script>
<script>
    $(function() {
        $( "#accordion" ).accordion({
            collapsible: true
        });
    });

    submit.onclick = function() {
        var doctor= document.getElementById("doctor").value;   //医生
        var createName= document.getElementById("createName").value;  //创建人
        var remarks= document.getElementById("remarks").value;   //随访内容
        var revisitContent= document.getElementById("revisitContent").value;   //随访结果
        var reservationsId= document.getElementById("reservationsId").value;   //预约id
        var revisitTime= document.getElementById("revisitTime").value;   //随访时间
        var doctorVisitId= document.getElementById("doctorVisitId").value;   //ID
        if(doctor==null||doctor==""){
            alert("请选择医生!");
        }else{
            $.ajax({
                url: "${ctxPath}/doctorLooked/updateDoctorContent",
                type: "post",
                data: {
                    doctor: doctor,
                    revisitTime: revisitTime,
                    createName:createName,
                    remarks: remarks,
                    revisitContent:revisitContent,
                    reservationsId: reservationsId,
                    doctorVisitId:doctorVisitId
                },
                success: function (data) {
                    alert('操作成功!');
                    window.parent.DoctorRevisit.table.refresh();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    parent.layer.close(index);
                },
                error: function (data) {
                    alert('内部故障!');
                }
            });
        }
    }

    function cancel() {
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.close(index);
    }
</script>
@}
